<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>$window服务</title>
		<script src="../org/angular.min.js"></script>
		<script type="text/javascript" src="../org/jquery.min.js" ></script>
	</head>
	<body>
		<div ng-app="hd" ng-controller="ctrl">
			<a href="" ng-click='get()'>get</a>
			<hr />
			{{message}}
			<hr />
			<button ng-click="getClientHeight()">内容高度</button>
			内容高度：{{clientHeight}}
			<hr />
			<button ng-click="getScrollHeight()">内容高度</button>
			内容高度：{{scrollHeight}}
			<hr />
			<a href="" ng-click="prompt()">请输入内容</a>
			您输入的内容是：{{content}}
		</div>
		<script>
			var m = angular.module('hd',[]);
			m.controller('ctrl',['$scope','$window',function($scope,$window){
				$scope.get = function(){
					if($window.confirm('Are you sure?')){
						$scope.message = 'I am sure';
					}else{
						$scope.message = 'I am not sure';
					}
				}
				
				$scope.getClientHeight = function(){
					$scope.clientHeight = $window.document.body.clientHeight;
				}
				$scope.getScrollHeight = function(){
					$scope.scrollHeight = $window.document.body.scrollHeight;
				}
				$scope.prompt = function(){
					$scope.content = $window.prompt('请输入内容');
				}
				
			}]);
		</script>
	</body>
</html>
